﻿using System;
using System.Data;
using DAO;
using DTO;

namespace BLO
{
    public class KhachHang_Blo
    {
        private readonly KhachHang_Dao _khachHangDao = new KhachHang_Dao();

        public DataTable GetAllObject()
        {
            return _khachHangDao.GetAllObject();
        }

        public int AddObject(KhachHang_Dto obj)
        {
            if (string.IsNullOrEmpty(obj.MaKH) || string.IsNullOrEmpty(obj.DiaChi)) return -1;

            return _khachHangDao.AddObject(obj);
        }

        public int EditObject(string id, KhachHang_Dto newObj)
        {
            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(newObj.DiaChi)) return -1;
            return _khachHangDao.EditObject(id, newObj);
        }

        public int DeleteObject(string id)
        {
            if (string.IsNullOrEmpty(id)) return -1;
            return _khachHangDao.DeleteObject(id);
        }

        public int AutoIncrementIDObject()
        {
            return _khachHangDao.AutoIncrementIDObject();
        }
    }
}